# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-elfesteem
pkgname=('python2-elfesteem' 'python-elfesteem')
_pkgname=ELFEsteem
pkgver=0.2.1
pkgrel=9
pkgdesc='Elf file manipulation library.'
arch=('any')
url='https://pypi.python.org/pypi/ElfEsteem/'
license=('GPL2')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://pypi.python.org/packages/85/86/5c67cebe6ef27de74cb7eb118485aa297f93fada6c6754120afa3c5ebbb9/$_pkgname-$pkgver.tar.gz")
sha512sums=('f9639cb0c6b795dcc583156e1403622d0a0f034211b35d0ba30b1f52ec1c3657fecd21defa560936d4ad68c13e1710fb56f7c9624d28bcfe6d09b245923253a2')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-elfesteem() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-elfesteem() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build

  mv "$pkgdir/usr/bin/elfcli" "$pkgdir/usr/bin/elfcli3"
}

